package cn.huihui.miniprogram.stuman.component;

import cn.huihui.miniprogram.stuman.database.model.Student;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;

import javax.security.auth.Subject;
import java.util.Collection;

@Data
@AllArgsConstructor
public class UserAuthentication implements Authentication  {

    Student student;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getDetails() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return student.getStudentId();
    }

    @Override
    public boolean isAuthenticated() {
        return true;
    }

    @Override
    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
    }

    @Override
    public String getName() {
        return student.getName();
    }

    @Override
    public boolean implies(Subject subject) {
        return false;
    }
}
